package com.milling.quartz.task;

import com.milling.business.mapper.WmsNeedleCacheMapper;
import com.milling.business.service.IWmsNeedleCacheService;
import com.milling.common.core.redis.RedisCache;
import com.milling.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 定时任务 将配针缓存区数量 同步到数据库，如果数量为0，则清空配针缓存位，运行补料；回流时需从此表获取钻针详细信息
 *
 * @author X
 */
@Component("needleTaskService")
public class NeedleTaskService
{
    private static final Logger logger = LoggerFactory.getLogger(NeedleTaskService.class);

    @Value("${mac.type}")
    private String mactype;

    @Autowired
    private IWmsNeedleCacheService wmsNeedleCacheService;

    public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
    {
        logger.info(StringUtils.format("执行多参方法： 字符串类型{}，布尔类型{}，长整型{}，浮点型{}，整形{}", s, b, l, d, i));
    }

    public void ryParams(String params)
    {
        System.out.println("执行有参方法：" + params);
    }

    public void ryNoParams()
    {
        System.out.println("执行无参方法");
    }

    public void handlerTask()
    {
        if("1".equals(mactype)) {
            wmsNeedleCacheService.sysncNeedleStatus();
        }
    }
}
